<?php defined('SYSPATH') or die('No direct script access.');

date_default_timezone_set('Europe/Warsaw');
setlocale(LC_ALL, 'pl_PL.utf-8');
spl_autoload_register(array('Kohana', 'auto_load'));
define('IN_PRODUCTION', true);

Kohana::init(array(
'base_url' => '/cms/',
'index_file' => FALSE,
'profiling' => !IN_PRODUCTION,
'caching' => IN_PRODUCTION,
'errors'=>true
));
ini_set('unserialize_callback_func', 'spl_autoload_call');
Kohana::$log->attach(new Kohana_Log_File(APPPATH.'logs'));
Kohana::$config->attach(new Kohana_Config_File);

Kohana::modules(array(
	'auth'       => MODPATH.'auth',       // Basic authentication
	'database'   => MODPATH.'database',   // Database access
	'orm'        => MODPATH.'orm',        // Object Relationship Mapping
	'pagination' => MODPATH.'pagination', // Paging of results
	));

i18n::$lang = 'pl';
//include('routes_user.php');
include('routes_cms.php');
// ERRORS
Route::set('catch_all', '<path>', array('path' => '.+'))
      ->defaults(array(
          'controller' => 'frontend_errors',
          'action' => '404'
  ));
// DEFAULT
Route::set('default', '((/<url>))')
->defaults(array(
	'controller' => 'frontend_show',
	'action'     => 'start',
));
echo Request::instance()
	->execute()
	->send_headers()
	->response;